package com.example.demo.Controller;

import com.example.demo.Dto.CheckoutDto;
import com.example.demo.Service.CheckoutService;
import com.example.demo.VO.CheckoutVo;
import com.example.demo.result.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/checkout")
public class CheckoutController {
    @Autowired
    private CheckoutService checkoutService;
    /**
     * 订单结算
     * @param checkoutDto
     * @return
     */
    @PostMapping
    public ResponseResult checkout(@RequestBody CheckoutDto checkoutDto){
        CheckoutVo checkoutVo = checkoutService.eddCheckout(checkoutDto);
        return new ResponseResult().ok(200,"订单结算成功",checkoutVo);
    }
}
